import requests
from libs.user_agent import UA


def get(url: str, referer: str, proxy_ip: str) -> (int, str):
    proxies = {
        "http": "http://%s:42233" % proxy_ip,
        "https": "http://%s:42233" % proxy_ip,
    }
    headers = {'User-Agent': UA.get()}
    if referer:
        headers['Referer'] = referer
    try:
        r = requests.get(url, headers=headers, timeout=10, proxies=proxies)
        return r.status_code, r.text
    except Exception as e:
        return 0, ""
